<?php

declare(strict_types=1);

namespace App\Request\User;

use Hyperf\Validation\Request\FormRequest;

class CategorySaveRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'income' => 'nullable|array',
            'expense' => 'nullable|array',
            'industry_id' => 'required|integer',
        ];
    }

    public function messages(): array
    {
        return [
            'income.array' => '收入分类格式错误',
            'expense.array' => '支出分类格式错误',
            'industry_id.required' => '行业id不能为空',
            'industry_id.integer' => '行业id格式错误',
        ];
    }
}
